#!/bin/bash

set -o errexit

test_dir="$(dirname $0)"
. $(dirname $0)/functions
src_dir="$(realpath $test_dir/..)"

if [[ $BUILD != "0" ]]; then
    echo "building, set BUILD=0 to suppress this"
    "$test_dir"/build || exit
else
  echo "run without building"
fi

create_namespace run-$GIT_BRANCH-$RANDOM
deploy_operator

desc 'create PSMDB cluster'
apply_cluster $src_dir/deploy/cr.yaml

wait_for_running my-cluster-name-rs0 3
